package com.qidian.buy.cms.controller;

import com.qidian.buy.cms.service.IContentService;
import com.qidian.buy.common.pojo.BuyResult;
import com.qidian.buy.pojo.Content;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 戴着假发的程序员
 * @company 起点编程
 * @date 2024/7/12 10:26
 */
@RestController
@CrossOrigin
@RequestMapping("/content")
public class ContentController {

    @Autowired
    private IContentService contentService;
    @GetMapping("/queryByCarMark")
    public BuyResult queryByCarMark(String catMark){
        return contentService.queryByCatMark(catMark);
    }
    @GetMapping("/list")
    public BuyResult list(Content content, @RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10") int limit){
        return contentService.queryPage(page,limit,content);
    }

    @PostMapping("/save")
    public BuyResult save(@RequestBody Content content){
        return contentService.saveContent(content);
    };

}
